The QTDrawable interface expresses the capabilities that all QuickTime drawing objects possess. The QTCanvas uses the following methods of the QTDrawable interface:
myQTCanvas.setVisible (false);
While the following methods are not used specifically in the relationship between QTCanvas and its client, they are presented here for the sake of completeness and also express capabilities that all QTDrawable objects possess:
All QTDrawable objects have the ability to clip their drawn pixels to a specified region. The getClip() and setClip() methods are used to get and set a clipping region. null can be used and returned, and it indicates that the QTDrawable currently has no clipping region set.
The DirectGroup display space enables one or more QTDrawable objects to draw into the same QTCanvas destination QDGraphics . It provides the capability to layer the objects in such a group, so that the objects do not draw over each other. This layering is achieved through the use of clipping regions. The DirectGroup clips its members so that members that are behind others cannot draw into the area where those in front are positioned. As this group by definition draws directly to the screen, this is the only means that can be used to avoid the flickering that would occur if the QTDrawable objects could not be clipped.
The QTDrawable interface also extends the Transformable interface. The Transformable interface expresses the ability of QuickTime drawers to have a matrix applied that will map the source pixels of a drawing object to some transformed destination appearance. A matrix allows the following transformations to be applied in the rendering process:
Your application can freely mix and match these different transformations at its own discretion.
All QTDrawable objects can have a matrix applied to them that will transform their visual appearance. A Sprite in a SpriteWorld can also have matrix transformations applied to it, as can a 3D model. The TwoDSprite also implements the Transformable interface.
The Transformable interface allows for applications to define behaviors that can be applied to any of these objects. For example, the quicktime.app.actions.Dragger , which will position objects in response to a mouseDragged event, is defined totally in terms of the Transformable interface. Thus, the Dragger can reposition any TwoDSprite in a SWCompositor or any QTDrawable in a GroupDrawable .
Using interfaces to express common functionality is a powerful concept and is relied upon extensively in the QuickTime for Java Application Framework.
| Previous | Chapter Top | Next |